package com.baizhi.bzmall.admin.controller;


import com.baizhi.bzmall.admin.service.IBzAttrService;
import com.baizhi.bzmall.common.vo.ResultEntity;
import com.baizhi.bzmall.entity.BzAttr;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 商品属性; InnoDB free: 11264 kB 前端控制器
 * </p>
 *
 * @author zhengg
 * @since 202-18
 */
@RestController
@RequestMapping("/bzAttr")
public class BzAttrController {
    @Autowired
    private IBzAttrService attrService;
    @GetMapping("/{type}/{cid}")
    public ResultEntity selectHalfAttr(@PathVariable("type") int type,@PathVariable("cid") int cid){
        QueryWrapper<BzAttr> wrapper= new QueryWrapper<>();
        wrapper.eq("attr_type",type);
        wrapper.eq("category_id",cid);
        List<BzAttr> list = attrService.list(wrapper);
        return ResultEntity.ok(list);
    }
}

